dr=0.0001; Nt=1000; Np=100;
Rstep=40000;
Starter=0.5;

Attractors=zeros(Np,Rstep+1);

for i=0:Rstep
	Xt=Starter;
	R=i*dr;
	for j=1:Nt
		Xt=R*Xt*(1-Xt);
	end
	for j=1:Np
		Xt=R*Xt*(1-Xt);
		Attractors(j,i+1)=Xt;
	end;
end;

BiFugure=figure;
set(BiFugure,'Units','centimeters','Position',[4 1 25 15]);
for i=1:Np
	plot(0:dr:dr*Rstep,Attractors(i,:),'.b','MarkerSize',1);
	hold on;
end;
title('Bifurcation Diagram of X_{n+1}=r\timesX_n\times(1-X_n)');
xlabel('r');
ylabel('Attractors');